package edu.gatech.coc.sirana.graph;

import java.util.ArrayList;

public class FDAEdge {
	private FDANode source;
	private FDANode sink;
	
	final String CONN = "=>";
	/**
	 * The timestamps of the source;
	 */
	private ArrayList<Long> visitingHistory;
	
	public FDAEdge(FDANode src, FDANode snk){
		this.setSink(snk);
		this.setSource(src);		
	}
	
	public boolean isBackEdge(){
		return this.source.getId() > this.sink.getId();
	}
	
	
	public boolean isSelfCycle(){
		return this.source.getId() == this.sink.getId();
	}
	
	public String findLabel(){
		StringBuffer sb = new StringBuffer();
//		if (this.source==null) return sink.getAction();
		sb.append(source.getAction() + CONN + sink.getAction());
		
		return sb.toString();
	}
	
	public FDANode getSource() {
		return source;
	}
	public void setSource(FDANode source) {
		this.source = source;
	}
	public FDANode getSink() {
		return sink;
	}
	public void setSink(FDANode sink) {
		this.sink = sink;
	}
	public ArrayList<Long> getVisitingHistory() {
		return visitingHistory;
	}
	public void setVisitingHistory(ArrayList<Long> visitingHistory) {
		this.visitingHistory = visitingHistory;
	} 
	
	
}
